from convdiffproblembase import ConvDiffProblemBase
from dolfin import *

class Knobloch2(ConvDiffProblemBase):
    '''Convection-Diffusion problem with boundary layers; one exponential at x=1 and two parabolic at y=0 and y=1.'''
    
    def __init__(self,eps=1E-7,N=10):
        self.name = 'K2'
    
        self.mesh = UnitSquare(N,N,'left')
        self.eps = Constant(eps)
        self.BCValues = [Constant(0.)]
        self.b = Constant((1.,0.))
        self.f = Constant(1.)
        self.BCIndicators = [Knobloch2.boundary.__func__]   # when Knobloch1.boundary is used, DirichletBC() raises error
                                                            # since it expects function type and this is instancemethod
                                                            # that's the reason for .__func__
    def boundary(x, on_boundary):
        return on_boundary
